home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / thrust-s.53 / thrust-s / thrust / datasrc / reverse.c < prev    next >
C/C++ Source or Header  |  1995-10-13  |  536b  |  34 lines

  1.  
  2. /* Written by Peter Ekberg, peda@lysator.liu.se */
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. int main(int argc,char *argv[])
  8. {
  9.   long j;
  10.   int i;
  11.   char ch;
  12.   int r;
  13.   
  14.   if(argc>2) {
  15.     fprintf(stderr, "%s: Usage %s [number]\n",argv[0],argv[0]);
  16.     exit(1);
  17.   }
  18.   
  19.   r=atoi(argv[1]);
  20.  
  21.   if(fseek(stdin,0L,SEEK_END))
  22.     perror(argv[0]);
  23.   for(j=ftell(stdin)/r-1; j>=0; j--) {
  24.     if(fseek(stdin,j*r,SEEK_SET))
  25.       perror(argv[0]);
  26.     for(i=0; i<r; i++) {
  27.       ch=fgetc(stdin);
  28.       fputc(ch,stdout);
  29.     }
  30.   }
  31.   
  32.   return(0);
  33. }
  34.